package com.aaa.system.Controller.Api;

import com.aaa.entity.Notice;
import com.aaa.system.aop.annotation.Log;
import com.aaa.system.service.NoticeService;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("system/api/notice")
public class ApiNoticeController {

    @Resource
    private NoticeService noticeService;

    /**
     *查询全部的通知数据 + 分页 + 模糊
     */
    @PostMapping("getAllList/{current}/{size}")
    public Result<IPage<Notice>> getAllList(@PathVariable Long current, @PathVariable Long size, @RequestBody Notice notice){
        return noticeService.getAllList(current,size,notice);
    }
    /**
     * 添加修改通知公告信息
     */
    @PostMapping("saveOrUpdateNotice")
    @Log(title = "添加/修改通知公告信息",business_type = "2")
    public Result<Boolean> saveOrUpdateNotice(@RequestBody Notice notice){
        return noticeService.saveOrUpdNotice(notice);
    }
    /**
     * 删除通知公告信息
     */
    @DeleteMapping("delNotice/{noticeIds}")
    @Log(title = "删除通知公告信息",business_type = "3")
    public Result<Boolean> delNotice(@PathVariable Long[] noticeIds){
        return noticeService.delNotice(noticeIds);
    }
}
